<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<probiz:pageHeading entityName="${newsletterGroup.name}" entityHeadingKey="newsletterGroupDetail.heading" />
<content tag="buttons">
	<probiz:iconBtn btnType="save" onclick="return fnDoSave(this,'newsletterGroupName');" />
	<probiz:iconBtn btnType="saveAndNext" onclick="return fnDoSaveAndNext(this,'newsletterGroupName');" />
	<probiz:iconBtn btnType="back" onclick="return fnDoCancelForm(this);" />
</content>
<probiz:showBindErrors bindPath="newsletterGroup.*" />
<div class="top clearfix">
	<ul class="tab">
		<li class="curr"><span><fmt:message key="newsletterGroup.formTabTitle"/></span></li>
	</ul>
</div>
<div class="modify">
	<form:form cssClass="mainForm" method="post" id="newsletterGroup" commandName="newsletterGroup"
		action="${ctxPath}/customer/newsletterGroup.html" onsubmit="return validateNewsletterGroup(this);">
		<form:hidden path="version" />
		<input type="hidden" name="newsletterGroupId" value="${newsletterGroup.newsletterGroupId}"/> 
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="com_modi_table">
			<tr>
				<th colspan="2" class="title"><h4><fmt:message key="newsletterGroup.group.basic"/></h4></th>
			</tr>
			<tr>
				<th class="label_width_1">
					<StoreAdmin:label key="newsletterGroup.name" />
				</th>
				<td>
					<spring:bind path="newsletterGroup.name">
						<input class="inputtxt" type="text" name="${status.expression}" id="${status.expression}" value="${status.value}" style="width:350px" maxlength="128"/>
						<span class="fieldError">${status.errorMessage}</span>
					</spring:bind>								
						</td>
			</tr>
			<tr>
				<th>
					<StoreAdmin:label key="newsletterGroup.description" />
				</th>
				<td>
					<textarea name="description" id="description" cols="60" rows="5" class="textareatxt"  style="width:350px">${newsletterGroup.description}</textarea>
						</td>
			</tr>
			<tr>
				<th>
					<StoreAdmin:label key="newsletterGroup.sortOrder" />
				</th>
				<td>
					<spring:bind path="newsletterGroup.sortOrder">
						<input class="inputtxt" type="text" name="${status.expression}"	id="${status.expression}" value="${status.value}" style="width:350px" />
						<span class="fieldError">${status.errorMessage}</span>
					</spring:bind>
				</td>
			</tr>
			<tr>
			<tr>
				<th colspan="2" class="title"><h4><fmt:message key="newsletterGroup.group.statusInfo"/></h4></th>
			</tr>
			<th>
				<StoreAdmin:label key="common.message.status" />
			</th>
			<td>
				<input type="hidden" id="_status" name="_status" value="on" />
				<input type="checkbox" id="status" onclick="changeStatus();" name="status" value="1"	<c:if  test="${newsletterGroup.status eq 1}">checked="true"</c:if> />&nbsp;
				<fmt:message key="status.active" />
			</td>
			</tr>
			<tr style="display: none;">
				<th>
					<StoreAdmin:label key="newsletterGroup.isVisibleToFront" />
				</th>
				<td>
					<input type="hidden" id="_isVisibleToFront"	name="_isVisibleToFront" value="on" />
					<input type="checkbox" id="isVisibleToFront" name="isVisibleToFront" value="1" <c:if  test="${newsletterGroup.isVisibleToFront eq 1}">checked="true"</c:if> />
				</td>
			</tr>
			<c:if test="${not empty newsletterGroup.newsletterGroupId}">
			<tr>
				<th colspan="2" class="title"><h4><fmt:message key="newsletterGroup.group.others"/></h4></th>
			</tr>
				
			<c:set var="createTime"><fmt:formatDate value="${newsletterGroup.createTime}" pattern="${appConfig.dateTimePattern}"/></c:set>
			<c:set var="updateTime"><fmt:formatDate value="${newsletterGroup.updateTime}" pattern="${appConfig.dateTimePattern}"/></c:set>
			<probiz:formText label="common.message.createTime" value="${createTime}" />
			<probiz:formText label="common.message.updateTime" value="${updateTime}" />
 			</c:if>	
		</table>
	</form:form>
</div>


<v:javascript formName="newsletterGroup" staticJavascript="false" />
<script type="text/javascript">
    document.forms["newsletterGroup"].elements["name"].focus();
    $j(document).ready(function(){
    	changeStatus();
    });
    function changeStatus(){
    	if($j("#status").attr("checked") == true){
    		$j("#isVisibleToFront").attr("checked", true);
    	}else{
    		$j("#isVisibleToFront").attr("checked", false);
    	}
    }
</script>
